//$Revision: 12 $
//$Date: 2012-09-04 19:20:15 +0000 (Tue, 04 Sep 2012) $
//$Author: dev@arbrebinaire.com $
/**
 * @fileOverview
 *
 * Ajax utilities
 * Requires:
 * jQuery
 *
 * @author     Francois Hetu <a href="mailto:dev@arbrebinaire.com">dev@arbrebinaire.com</a>
 * @version    SVN: $$Id: ajax.js 12 2012-09-04 19:20:15Z dev@arbrebinaire.com $$
 */

var ArbreBinaire = ArbreBinaire || {};
ArbreBinaire.Ajax = (function(ajax, $){
	var call = function (scriptUrl, outgoingData, successCallback, errorCallback, completeCallBack, beforeSendCallback){
		    $.ajax({
		        type: "POST",
		        url: scriptUrl,
		        data: outgoingData,
		        beforeSend: typeof beforeSendCallback !== 'undefined' ? beforeSendCallback : function(){
		        },
		        success: successCallback,
		        error: typeof errorCallback !== 'undefined' ? errorCallback : function(){
		        },
		        complete: typeof completeCallBack !== 'undefined' ? completeCallBack : function(){
		        },
		        dataType: "json"
		    });
		};
		ajax.call = call;
	return ajax;
})(ArbreBinaire.Ajax || {}, jQuery);